* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
- *
+ *
* See COPYRIGHTS file for copyrights information.
*/
{
CRAttrSel *cur_sel = NULL;
- g_return_val_if_fail (a_this && a_attr_sel,
+ g_return_val_if_fail (a_this && a_attr_sel,
CR_BAD_PARAM_ERROR);
- for (cur_sel = a_this;
- cur_sel->next;
+ for (cur_sel = a_this;
+ cur_sel->next;
cur_sel = cur_sel->next) ;
cur_sel->next = a_attr_sel;
*Returns CR_OK upon successful completion, an error code otherwise.
*/
enum CRStatus
-cr_attr_sel_prepend_attr_sel (CRAttrSel * a_this,
+cr_attr_sel_prepend_attr_sel (CRAttrSel * a_this,
CRAttrSel * a_attr_sel)
{
- g_return_val_if_fail (a_this && a_attr_sel,
+ g_return_val_if_fail (a_this && a_attr_sel,
CR_BAD_PARAM_ERROR);
a_attr_sel->next = a_this;
if (cur->name) {
guchar *name = NULL;
- name = (guchar *) g_strndup (cur->name->stryng->str,
+ name = (guchar *) g_strndup (cur->name->stryng->str,
cur->name->stryng->len);
if (name) {
g_string_append (str_buf, (const gchar *) name);
if (cur->value) {
guchar *value = NULL;
- value = (guchar *) g_strndup (cur->value->stryng->str,
+ value = (guchar *) g_strndup (cur->value->stryng->str,
cur->value->stryng->len);
if (value) {
switch (cur->match_way) {
a_this->next = NULL;
}
- if (a_this) {
- g_free (a_this);
- a_this = NULL;
- }
+ g_clear_pointer (&a_this, g_free);
}
g_string_free (stringue, TRUE);
stringue = NULL;
}
- if (str) {
- g_free (str);
- str = NULL;
- }
+ g_clear_pointer (&str, g_free);
return result;
}
{
g_return_if_fail (a_this);
- if (a_this->priv) {
- g_free (a_this->priv);
- a_this->priv = NULL;
- }
+ g_clear_pointer (&a_this->priv, g_free);
g_free (a_this);
}
return CR_BAD_PARAM_ERROR;
}
- if (a_this->name) {
- g_free (a_this->name);
- a_this->name = NULL;
- }
+ g_clear_pointer (&a_this->name, g_free);
a_this->name = a_name;
return CR_OK;
for (cur_ff = a_this; cur_ff && cur_ff->next; cur_ff = cur_ff->next) ;
for (; cur_ff; cur_ff = cur_ff->prev) {
- if (a_this->name) {
- g_free (a_this->name);
- a_this->name = NULL;
- }
+ g_clear_pointer (&a_this->name, g_free);
if (cur_ff->next) {
g_free (cur_ff->next);
file_ptr = NULL;
}
- if (buf) {
- g_free (buf);
- buf = NULL;
- }
+ g_clear_pointer (&buf, g_free);
return result;
}
return;
error:
- if (str) {
- g_free (str);
- str = NULL;
- }
+ g_clear_pointer (&str, g_free);
if (decl) {
cr_declaration_destroy (decl);
PRIVATE (a_this) = NULL;
}
- if (a_this) {
- g_free (a_this);
- a_this = NULL;
- }
+ g_clear_pointer (&a_this, g_free);
}
{
g_return_if_fail (a_this);
- if (a_this->msg) {
- g_free (a_this->msg);
- a_this->msg = NULL;
- }
+ g_clear_pointer (&a_this->msg, g_free);
g_free (a_this);
}
}
}
- if (PRIVATE (a_this)->err_stack) {
- g_list_free (PRIVATE (a_this)->err_stack);
- PRIVATE (a_this)->err_stack = NULL;
- }
+ g_clear_pointer (&PRIVATE (a_this)->err_stack, g_list_free);
return CR_OK;
}
PRIVATE (a_this) = NULL;
}
- if (a_this) {
- g_free (a_this);
- a_this = NULL; /*useless. Just for the sake of coherence */
- }
+ g_clear_pointer (&a_this, g_free);
}
/*walk backward the list and free each "next element" */
for (cur = cur->prev; cur && cur->prev; cur = cur->prev) {
- if (cur->next) {
- g_free (cur->next);
- cur->next = NULL;
- }
+ g_clear_pointer (&cur->next, g_free);
}
if (!cur)
return;
- if (cur->next) {
- g_free (cur->next);
- cur->next = NULL;
- }
+ g_clear_pointer (&cur->next, g_free);
g_free (cur);
}
g_string_append (stringue, "}");
result = g_string_free (stringue, FALSE);
- if (tmp_str) {
- g_free (tmp_str);
- tmp_str = NULL;
- }
+ g_clear_pointer (&tmp_str, g_free);
return result;
}
cr_utils_dump_n_chars2 (' ', stringue, a_indent);
g_string_append_printf (stringue,
"@charset \"%s\" ;", str);
- if (str) {
- g_free (str);
- str = NULL;
- }
+ g_clear_pointer (&str, g_free);
}
if (stringue) {
str = g_string_free (stringue, FALSE);
/*walk backward and free next element */
for (cur = cur->prev; cur && cur->prev; cur = cur->prev) {
- if (cur->next) {
- g_free (cur->next);
- cur->next = NULL;
- }
+ g_clear_pointer (&cur->next, g_free);
}
if (!cur)
return;
/*free the one remaining list */
- if (cur->next) {
- g_free (cur->next);
- cur->next = NULL;
- }
+ g_clear_pointer (&cur->next, g_free);
g_free (cur);
cur = NULL;
if (result->priv == NULL) {
cr_utils_trace_info ("Out of memory");
- if (result) {
- g_free (result);
- result = NULL;
- }
+ g_clear_pointer (&result, g_free);
return NULL;
}